/**
 * 
 */
package com.zhangjihao.java.test;

import java.io.Serializable;

/**
 * 说明：
 * 
 * @author  zhangjihao(mailto:zhangjihao@sohu.com)
 * @version v1.0
 * 创建于：2020年4月25日 下午4:51:53
 */
public class User implements Serializable, Comparable<User> {

	private static final long serialVersionUID = 1L;

	private Integer id;
	
	private String name;

	
	
	
	public User(Integer id, String name) {
		super();
		this.id = id;
		this.name = name;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public String toString() {
		return "{id=" + id + ", name=" + name + "}";
	}

	//1:升序     0：不排序     -1：倒序
	@Override
	public int compareTo(User o) {
		if(this.id == null || o == null || o.id == null){
			return 0;
		}
		return this.id > o.id ? 1 : -1;
	}
	
	
}
